home *** CD-ROM | disk | FTP | other *** search
/ PD ROM 1 / PD ROM Volume I - Macintosh Software from BMUG (1988).iso / Programming / Programming Tools / Turbo Pascal / Logweed / CVTLOG30.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1987-07-01  |  2.9 KB  |  94 lines  |  [TEXT/ttxt]

  1. Program ConVerTLog {3.0 to 3.1};
  2.  
  3. Type
  4.   Datestring = string[8];
  5.   CommentString = string[12];
  6.   Filename = string[24];
  7.  
  8. LogRec31 = Record
  9.   usage: char;              {usage type, i.e. business/personal}
  10.   start_date_log : Datestring;     {start date}
  11.   start_time_log : Datestring;     {start time}
  12.   end_time_log   : Datestring;     {end time}
  13.   elapsed_log    : Datestring;     {elapsed time}
  14.   comment        : CommentString;  {comment}
  15.   end;
  16.  
  17. LogRec30 = Record
  18.   usage: char;              {usage type, i.e. business/personal}
  19.   start_date_log : Datestring;     {start date}
  20.   start_time_log : Datestring;     {start time}
  21.   end_time_log   : Datestring;     {end time}
  22.   elapsed_log    : Datestring;     {elapsed time}
  23.   comment        : CommentString;  {comment}
  24.   elapsed_real   : Real;           {elapsed time stored as real no.}
  25.   end;
  26.  
  27. Var
  28.   logfile31      : file of LogRec31;
  29.   logfile30      : file of LogRec30;
  30.   log_data30     : logrec30;
  31.   log_data31     : logrec31;
  32.   i              : integer;
  33.   ch             : char;
  34.  
  35. Const
  36.   logfile31name    : filename = 'TIME31.LOG';
  37.   logfile30name    : filename = 'TIME30.LOG';
  38.  
  39.  
  40. Procedure initialize_variables;
  41. begin
  42.   log_data31.comment:= '';
  43. end;
  44.  
  45.  
  46. Begin   {program}
  47.  
  48. lowvideo;
  49. writeln;
  50. writeln('This program will convert a LOG V 3.0 TIME.LOG file to a');
  51. writeln('LOG V 3.1 TIME.LOG file.  First you must rename the 3.0');
  52. writeln('TIME.LOG file to TIME30.LOG.  This program will then create');
  53. writeln('the file TIME31.LOG, which you must rename TIME.LOG in order');
  54. writeln('to use it with the LOG program.  This may seem like a lot of');
  55. writeln('screwing around, but it''ll help prevent accidentally overwriting');
  56. writeln('wanted files.  Besides, what do you expect for free?');
  57. writeln;
  58. writeln('Press any key to continue, ^C to abort...');
  59. read(kbd,ch);
  60.   initialize_variables;
  61.  
  62.   Assign(logfile31,logfile31name);
  63.   Rewrite(logfile31);
  64.   Assign(logfile30,logfile30name);
  65.   reset(logfile30);
  66.  
  67.   for i:=0 to filesize(logfile30)-1 do
  68.   begin
  69.     seek(logfile30,i);
  70.     read(logfile30,log_data30);
  71.     log_data31.usage:= log_data30.usage;
  72.     if log_data31.usage=#0 then log_data31.usage:='@';
  73.     log_data31.start_date_log:= log_data30.start_date_log;
  74.     log_data31.start_time_log:= log_data30.start_time_log;
  75.     log_data31.end_time_log:= log_data30.end_time_log;
  76.     log_data31.elapsed_log:= log_data30.elapsed_log;
  77.     if length(log_data30.comment)>0 then
  78.       log_data31.comment:=copy(log_data30.comment,1,12);
  79.     seek(logfile31,filesize(logfile31));
  80.     write(logfile31,log_data31);
  81.     writeln;
  82.     writeln(log_data31.usage);
  83.     writeln(log_data31.start_date_log);
  84.     writeln(log_data31.start_time_log);
  85.     writeln(log_data31.end_time_log);
  86.     writeln(log_data31.elapsed_log);
  87.     writeln(log_data31.comment);
  88.   end; {for}
  89.  
  90.   Close(logfile31);
  91.   Close(logfile30);
  92.  
  93. End.
  94.